﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Main.Master" CodeBehind="ReservationManagement.aspx.cs"
    Inherits="VSM.ReservationManagement" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <script type="text/javascript">
        function CheckAll(oCheckbox) {
            var GridView2 = document.getElementById("<%=grdItem.ClientID %>");
            for (i = 1; i < GridView2.rows.length; i++) {
                GridView2.rows[i].cells[0].getElementsByTagName("INPUT")[0].checked = oCheckbox.checked;
            }
        }

        function openReservarion(gID) {
            var url = "P_Reservation.aspx?ResID=" + gID;
            Main.openCustomDialog(url, 950, 700);
        };

        function newReservation() {
            var url = "P_Reservation.aspx";
            Main.openCustomDialog(url, 950, 700);
        }

        function openServiceRequest(ResID) {
            var url = "ServiceRequest.aspx?ResID="+ ResID;
            window.open(url, '_self');
        }
    </script>
    <div>
        <asp:UpdatePanel ID="updatePanel" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                <table border="0" width="100%" style="background-color: #D1D4D8;">
                    <tr>
                        <td class="FormLineItemAlt" style="width: 10%">
                            From Date:
                        </td>
                        <td class="FormLineItemAlt" style="width: 35%">
                            <asp:TextBox ID="txtFromDate" runat="server" Width="35%"></asp:TextBox>
                            <asp:ImageButton ID="ImageButton1" runat="Server" AlternateText="Click to show calendar"
                                ImageUrl="~/Images/Calendar_scheduleHS.png" />
                            <cc1:CalendarExtender ID="CalendarExtender2" runat="server" TargetControlID="txtFromDate"
                                PopupButtonID="ImageButton1" Format="dd/MM/yyyy">
                            </cc1:CalendarExtender>
                            ToDate:
                            <asp:TextBox ID="txtToDate" runat="server" Width="35%"></asp:TextBox>
                            <asp:ImageButton ID="ImageButton2" runat="Server" AlternateText="Click to show calendar"
                                ImageUrl="~/Images/Calendar_scheduleHS.png" />
                        </td>
                        <td class="FormLineItemAlt" style="width: 10%">
                            &nbsp;
                        </td>
                        <td class="FormLineItemAlt" style="width: 35%">
                            <cc1:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txtToDate"
                                PopupButtonID="ImageButton2" Format="dd/MM/yyyy">
                            </cc1:CalendarExtender>
                        </td>
                    </tr>

                    <tr>
                        <td class="FormLineItemAlt" style="width: 10%">
                            Reservation No:
                        </td>
                        <td class="FormLineItemAlt" style="width: 35%">
                            <asp:TextBox ID="txt_ResNo" runat="server" ClientIDMode="Static" 
                                Width="70%"></asp:TextBox>
                        </td>
                        <td class="FormLineItemAlt" style="width: 15%">
                            &nbsp;
                        </td>
                        <td class="FormLineItemAlt" style="width: 35%">
                            &nbsp;
                        </td>
                    </tr>

                    <tr>
                        <td class="FormLineItemAlt" style="width: 10%">
                            Customer Name:
                        </td>
                        <td class="FormLineItemAlt" style="width: 35%">
                            <asp:TextBox ID="txt_CustomerName" runat="server" ClientIDMode="Static" 
                                Width="70%"></asp:TextBox>
                        </td>
                        <td class="FormLineItemAlt" style="width: 15%">
                            &nbsp;
                        </td>
                        <td class="FormLineItemAlt" style="width: 35%">
                            &nbsp;
                        </td>
                    </tr>

                    <tr>
                        <td class="FormLineItemAlt" style="width: 10%">
                            VIN:
                        </td>
                        <td class="FormLineItemAlt" style="width: 35%">
                            <asp:TextBox ID="txt_VIN" runat="server" ClientIDMode="Static" 
                                Width="70%"></asp:TextBox>
                        </td>
                        <td class="FormLineItemAlt" style="width: 15%">
                            &nbsp;
                        </td>
                        <td class="FormLineItemAlt" style="width: 35%">
                            &nbsp;
                        </td>
                    </tr>

                     <tr>
                        <td class="FormLineItemAlt" style="width: 10%">
                            Reg No:
                        </td>
                        <td class="FormLineItemAlt" style="width: 35%">
                            <asp:TextBox ID="txt_RegNo" runat="server" ClientIDMode="Static" 
                                Width="70%"></asp:TextBox>
                        </td>
                        <td class="FormLineItemAlt" style="width: 15%">
                            &nbsp;
                        </td>
                        <td class="FormLineItemAlt" style="width: 35%">
                            &nbsp;
                        </td>
                    </tr>

                </table>
                <table border="0" width="100%" style="background-color: #D1D4D8;">
                    <tr>
                        <td class="FormLineItemAlt">
                            <asp:Button ID="btn_Filter" runat="server" BackColor="#1B7FC2" ForeColor="#FFFFFF"
                                Height="30px" Text="Filter" Width="100px" OnClick="btn_Filter_Click" CausesValidation="false" />
                            <asp:Button ID="btn_NewReservation" runat="server" BackColor="#1B7FC2" 
                                CausesValidation="false" ForeColor="#FFFFFF" Height="30px" 
                                Text="New Reservation" Width="100px" OnClientClick='newReservation()'/>
                        </td>
                    </tr>
                </table>
                <br />
                <div style="height: 490px; overflow: scroll">
                    <table style="width: 100%; border: 1px;" cellpadding="3" cellspacing="0">
                        <tr>
                            <td colspan="2" style="text-align: center;">
                                <asp:GridView ID="grdItem" runat="server" CssClass="GridInner" Width="100%" BorderColor="White"
                                    BackColor="White" AllowSorting="True" AutoGenerateColumns="False" CellPadding="2"
                                    HeaderStyle-Height="27px" OnSorting="grdItem_Sorting" OnRowDataBound="grdItem_RowDataBound">
                                    <RowStyle BackColor="#D9E0ED" ForeColor="Black" BorderColor="White" BorderWidth="2px"
                                        Height="25px" />
                                    <AlternatingRowStyle BackColor="#EEF1F7" BorderColor="White" BorderWidth="2px" Height="25px" />
                                    <Columns>
                                        <asp:TemplateField HeaderText="Action">
                                            <ItemStyle HorizontalAlign="Center" Width="150px" />
                                            <HeaderStyle VerticalAlign="Middle" />
                                            <ItemTemplate>
                                                <asp:Button ID="btnView" runat="server" Width="50px" Text="View" BackColor="#1B7FC2"
                                                    ForeColor="#FFFFFF" OnClientClick='<%#"openReservarion(\"" +Eval("ResID") +"\");" %>' />
                                                     <asp:Button ID="btn_MakeService" runat="server" Width="90px" Text="Create Service" BackColor="#1B7FC2"
                                                    ForeColor="#FFFFFF" OnClientClick='<%#"openServiceRequest(\"" +Eval("ResID") +"\");" %>' />
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <%--<asp:TemplateField>
                                            <ItemStyle HorizontalAlign="Center" Width="2%" />
                                            <HeaderTemplate>
                                               
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:CheckBox ID="chkChild" runat="server" Visible='<%# (Convert.ToInt32(Eval("Status")) == 0 || Convert.ToInt32(Eval("Status")) == 3)? true: false  %>' />
                                            </ItemTemplate>
                                        </asp:TemplateField>--%>
                                        <asp:TemplateField HeaderText="ID" SortExpression="ItemCode">
                                            <ItemStyle HorizontalAlign="left" Width="25px" />
                                            <HeaderStyle VerticalAlign="Middle" />
                                            <ItemTemplate>
                                                <asp:Label ID="lbResID" runat="server" Text='<%# Bind("ResID") %>' BorderStyle="none">
                                                </asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Seq No">
                                            <ItemStyle HorizontalAlign="Left" Width="30px" />
                                            <HeaderStyle VerticalAlign="Middle" Font-Bold="true" />
                                            <ItemTemplate>
                                                <asp:Label ID="lbSeqNo" runat="server" Text='<%# Bind("SeqNo") %>'></asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Res Date">
                                            <ItemStyle HorizontalAlign="Left" Width="60px" />
                                            <HeaderStyle VerticalAlign="Middle" Font-Bold="true" />
                                            <ItemTemplate>
                                                <asp:Label ID="lbResDate" runat="server" Text='<%# Bind("ResDate","{0:dd/MM/yyyy}") %>'></asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                       
                                        <asp:TemplateField HeaderText="Res Time">
                                            <ItemStyle HorizontalAlign="Left" Width="30px" />
                                            <HeaderStyle VerticalAlign="Middle" Font-Bold="true" />
                                            <ItemTemplate>
                                                <asp:Label ID="lbResTime" runat="server" Text='<%# Bind("ResTime") %>'></asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>

                                        <asp:TemplateField HeaderText="VIN" SortExpression="ItemName">
                                            <ItemStyle HorizontalAlign="left" Width="140px" />
                                            <HeaderStyle VerticalAlign="Middle" />
                                            <ItemTemplate>
                                                <asp:Label ID="lbVIN" runat="server" Text='<%# Bind("VIN") %>' BorderStyle="none">
                                                </asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Customer" SortExpression="Customer">
                                            <ItemStyle HorizontalAlign="left" Width="150px" />
                                            <HeaderStyle VerticalAlign="Middle" />
                                            <ItemTemplate>
                                                <asp:Label ID="lbCustomerName" runat="server" Text='<%# Bind("CustomerName") %>'
                                                    BorderStyle="none">
                                                </asp:Label>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        
                                        <asp:TemplateField HeaderText="Address">
                                            <ItemStyle HorizontalAlign="Left" />
                                            <HeaderStyle VerticalAlign="Middle" Width="170px" />
                                            <ItemTemplate>
                                                <asp:Label ID="lbAddress" Style="text-align: left" runat="server" Text='<%# Bind("Address") %>' />
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                    </Columns>
                                    <PagerStyle BackColor="#C6C3C6" ForeColor="Black" HorizontalAlign="Right" />
                                    <SelectedRowStyle BackColor="#9471DE" Font-Bold="true" ForeColor="White" />
                                    <HeaderStyle BackColor="#6095C9" Font-Bold="true" ForeColor="#ffffff" Font-Overline="False"
                                        Height="27px" VerticalAlign="Bottom" />
                                    <EmptyDataTemplate>
                                        No Data Found.
                                    </EmptyDataTemplate>
                                </asp:GridView>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" style="text-align: center;">
                            </td>
                        </tr>
                    </table>
                </div>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
</asp:Content>
